home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.misc,comp.lang.perl.misc,comp.lang.tcl,comp.lang.c,comp.lang.java
- Subject: Re: Readable Perl (was: Re: Relative Speed of Perl vs. Tcl vs. C)
- Date: 15 Feb 1996 14:58:53 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4g0drdINN167@keats.ugrad.cs.ubc.ca>
- References: <4e3a2u$eoa@wcap.centerline.com> <4fncgf$96e@solutions.solon.com> <JTV2J.96Feb12142743@mamba.cs.virginia.edu> <ukd97hwzkc.fsf_-_@linda.teleport.com>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <ukd97hwzkc.fsf_-_@linda.teleport.com>,
- Randal L. Schwartz <merlyn@stonehenge.com> wrote:
- >>>>>> "John" == John Viega <jtv2j@mamba.cs.virginia.edu> writes:
- >
- >John> People bitch about the readability of Perl non-stop. In fact, I have
- >John> heard the joke, "Perl, the only language you can uuencode, and not
- >John> notice" twice this week around the department.
- >
- >OK, now which do you find most readable...
- >
- > $i = 1;
- > while ($i <= 10) {
- > print "I can count to $i\n";
- > $i++;
- > }
- >
- > for ($i = 1; $i <= 10; $i++) {
- > print "I can count to $i\n";
- > }
- >
- > foreach $i (1..10) {
- > print "I can count to $i\n";
- > }
- >
- > $i = 0;
- > print "I can count to $i\n" while ++$i <= 10;
- >
- > print map "I can count to $_\n", 1..10;
- >
- > 50 FOR I = 1 TO 10
- > 60 PRINT "I CAN COUNT TO ",I
- > 70 NEXT I
-
- None of the above, bud.
-
- I find this readable
-
- for x in 1 2 3 4 5 6 7 8 9 10 ; do
- echo "I can count to" $x
- done
-
- followed by, in second place:
-
- x=1
- while [ ! "$x" = "11" ] ; do
- echo "I can count to" $x
- : $(( x += 1 ))
- done
-
- ...and third place:
-
- ...
- movl $1, %edx
- loop: pushl %edx
- movl $message, %eax
- pushl %eax
- call _printf
- inc %edx
- cmpl $10, %edx
- jae loop
- ...
- message .ascii "I can count to %d\n\0"
- --
-
-